package com.kefu.exam.vo;

import javax.validation.constraints.Size;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractUpdateVo;
import com.kefu.exam.model.ExamPaper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xy
 * @date 2022/02/28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "考卷表")
public class ExamPaperUpdateVo extends AbstractUpdateVo<ExamPaper,String> {

    @NotEmpty
    @ApiModelProperty(value = "主键")
    private String paperId;
    @Size(max = 500)
    @ApiModelProperty(value = "试卷名")
    private String paperName;
    @Size(max = 500)
    @ApiModelProperty(value = "试卷描述")
    private String paperDescription;

    @Override
    public ExamPaper convert() {
        ExamPaper info = new ExamPaper();
        info.setPaperId(paperId);
        info.setPaperName(paperName);
        info.setPaperDescription(paperDescription);
        KefuContext context = KefuContext.getKefuContext();
        info.setUpdateUser(context.getUserId());
        info.setUpdateTime(context.getNow());
        info.setUpdateName(context.getUserName());
        return info;
	}
}